<template>
  <ul class="selectbar"  >
    <li class="select" :class="{'active': actived}" @click.stop="change($event)">{{text[0]}}</li>
    <li class="select" :class="{'active': !actived}" @click.stop="change($event)">{{text[1]}}</li>
  </ul>
</template>

<script>
export default {
  data () {
    return {
      'actived': true
    }
  },
  props: {
    text: {
      type: Array
    }
  },
  methods: {
    change (e) {
      if (e.target.className.search('active') < 0) {
        this.actived = !this.actived
        this.$emit('selectChange', e)
      }
    }
  }
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.selectbar {
  display: flex;
  padding-top: 20px;
  margin-bottom: 26px;
  width: 100%;
  height: 60px;
  justify-content: center;
  list-style: none;
  cursor: pointer;
  user-select: none;
  .select {
    width: 172px;
    height: 60px;
    text-align: center;
    line-height: 4.2857rem;
    font-size: 1.42857rem;
    background-color: #f2f4f9;
    color: #333;
    text-decoration: none;
    border: 1px solid #e3e3e3;
    &.active {
      position: relative;
      color: #2ee1e0;
      background: #fff;
      border-bottom: none;
      &:before {
        display: block;
        position: absolute;
        top: 4px;
        left: calc(50% - 14px);
        width: 0;
        height: 0;
        border-left: 14px solid transparent;
        border-right: 14px solid transparent;
        border-top: 8px solid #2ee1e0;
        content: "";
      }
      &:after {
        display: block;
        position: absolute;
        left: 0;
        top: -1px;
        width: 100%;
        border-top: 6px solid #2ee1e0;
        content: "";
      }
    }
  }
}
</style>
